home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Utilities Experience
/
The Utilities Experience - Volume 1.iso
/
software
/
comms
/
voodoo
/
contrib
/
smtpsend
/
smtpsend.rexx
Wrap
OS/2 REXX Batch file
|
1995-12-06
|
2KB
|
79 lines
/*) SMTPSend v1.0 by Josef Faulkner (panther@gate.net) IRC: Josef
\\\ Simple SMTP mail sender. Specify your SMTP host below.
(*/
SMTPHost = 'cyber.gate.net'
options results
if ~show('L','rexxsupport.library') then if
~addlib('rexxsupport.library',0,-30,0) then exit(20)
parse arg file
file=strip(file)
if ~showlist(H,'TCP') then address command 'mount TCP: from
amitcp:devs/inet-mountlist'
if ~showlist(H,'TCP') then address command 'mount TCP:'
if showlist(H,'TCP') then do
foundsubj=0
foundto=0
foundfrom=0
call open(1,file,r)
do until (eof(1))|(strip(text)='')
text=readln(1)
select
when upper(word(text,1))='SUBJECT:' then do
parse var text .' 'subj
subj=strip(subj)
foundsubj=1
end
when upper(word(text,1))='TO:' then do
parse var text .' 'to
to=strip(to)
foundto=1
end
when upper(word(text,1))='FROM:' then do
parse var text .'<'from'>'.
from=strip(from)
foundfrom=1
end
otherwise nop
end
end
if (foundto)&(foundfrom) then do
call close(1)
call open(1,'tcp:'smtphost'/25',w)
call writeln(1,'HELO')
call writeln(1,'MAIL FROM: '||from)
call writeln(1,'RCPT TO: '||to)
call writeln(1,'DATA')
call open(2,file,r)
do until eof(2)
text=readln(2)
if text='.' then text=' .'
call writeln(1,text)
end
call close(2)
call writeln(1,'.')
call writeln(1,'QUIT')
call close(1)
address command 'Requestchoice title="SMTPSend" BODY="Mail Sent."
GADGETS="Ok" >NIL:'
end
else do
select
when ~((foundto)&(foundfrom)) then address command 'Requestchoice
title="SMTPSend" BODY="Mail NOT sent. *nTo: and From: not specified."
GADGETS="Ok" >NIL:'
when ~(foundfrom) then address command 'Requestchoice title="SMTPSend"
BODY="Mail NOT sent. *nFrom: not specified." GADGETS="Ok" >NIL:'
when ~(foundto) then address command 'Requestchoice title="SMTPSend"
BODY="Mail NOT sent. *nTo: not specified." GADGETS="Ok" >NIL:'
otherwise address command 'Requestchoice title="SMTPSend" BODY="Mail NOT
sent. *nArexx logic error." GADGETS="Ok" >NIL:'
end
end
end
else address command 'Requestchoice title="SMTPSend" BODY="Mail NOT sent.
*nCouldn''t mount TCP:" GADGETS="Ok" >NIL:'
exit